package com.wsc.wisdomchina.adapter;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.wsc.wisdomchina.R;
import com.wsc.wisdomchina.javaBean.CommunityListBean;

import java.util.List;

/**
 * Created by Administrator on 2017/3/2 0002.
 */

public class HelpOldAdapter extends BaseAdapter{
    private Context context;
    private List<CommunityListBean> list;

    public HelpOldAdapter(Context context, List<CommunityListBean> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return list.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, final View convertView, ViewGroup parent) {
        Zhulaofuwu_holder holder=null;
       View view=convertView;
        if(view==null){
            view= LayoutInflater.from(context).inflate(R.layout.zhulaofuwu_item,null);
            holder=new Zhulaofuwu_holder(view);
            view.setTag(holder);
        }else {
            holder= (Zhulaofuwu_holder) view.getTag();
        }
        CommunityListBean communityListBean=list.get(position);
        holder.name.setText(communityListBean.getTitle());
        holder.xiangqingmiaoshu.setText(communityListBean.getIntro());
        Glide.with(context).load(communityListBean.getGuideImg()).into(holder.content_tu);
        return view;
    }
    public class Zhulaofuwu_holder{
        private ImageView content_tu;
        private TextView name;
        private TextView xiangqingmiaoshu;
        public Zhulaofuwu_holder(View view) {
            content_tu= (ImageView) view.findViewById(R.id.content_tu);
            name= (TextView) view.findViewById(R.id.name);
            xiangqingmiaoshu= (TextView) view.findViewById(R.id.xiangqingmiaoshu);
        }
    }
}
